package midas.mw.crt.common;

import java.io.Serializable;

/**
 * 
 * Superclass for CRT messages
 *
 */
public class CrtMessage implements Serializable
{
	/**
	 * Default serial version ID
	 */
	private static final long serialVersionUID = 1L;

	/** 
	 * Source MIDAS node identifier
	 */
	protected String sourceNodeId;
	
	/** 
	 * Source CRT user identifier
	 */
	protected String sourceUserId;
	
	/** 
	 * Destination CRT user identifier
	 */
	protected String destinationUserId;
	
	/** 
	 * Message content
	 */
	protected byte[] messageContent;
	
	/**
	 * Unique message identifier
	 */
	protected Long messageId;
	
	/**
	 * Constructor - initialising all object attributes.
	 * @param sourceNodeId Source MIDAS node identifier value.
	 * @param sourceUserId Source CRT user identifier value.
	 * @param destinationUserId Destination CRT user identifier value.
	 * @param messageContent Message content value.
	 */
	protected CrtMessage(String sourceNodeId,  String sourceUserId, String destinationUserId, byte[] messageContent) 
	{
		this.sourceNodeId 		= sourceNodeId;		
		this.sourceUserId		= sourceUserId;
		this.destinationUserId 	= destinationUserId;		
		this.messageContent 	= messageContent;
	}
	
	/**
	 * @deprecated Constructor - initialising all object attributes.
	 * @param sourceNodeId Source MIDAS node identifier value.
	 * @param sourceUserId Source CRT user identifier value.
	 * @param destinationUserId Destination CRT user identifier value.
	 * @param messageContent Message content value.
	 */
	protected CrtMessage(String sourceNodeId,  String sourceUserId, String destinationUserId, String messageContent) 
	{
		this.sourceNodeId 		= sourceNodeId;		
		this.sourceUserId		= sourceUserId;
		this.destinationUserId 	= destinationUserId;		
		this.messageContent 	= messageContent.getBytes();
	}
	
	/**
	 * Constructor - No initiation of attributes.
	 */
	protected CrtMessage() 
	{
		//No initialisation
	}
	
	/**
	 * Gets the source node identifier value.
	 * @return Source MIDAS node identifier value.
	 */
	public String getSourceNodeId()
	{
		return sourceNodeId;
	}
	
	/**
	 * Sets the source node identifier value.
	 * @param sourceNodeId Source MIDAS node identifier value.
	 */
	public void setSourceNodeId(String sourceNodeId)
	{
		this.sourceNodeId = sourceNodeId;
	}
	
	/**
	 * Gets the source CRT user identifier value
	 * @return Source CRT user identifier value
	 */
	public String getSourceUserId()
	{
		return sourceUserId;
	}
	
	/**
	 * Sets the source CRT user identifier value
	 * @param sourceUserId Source CRT user identifier value
	 */
	public void setSourceUserId(String sourceUserId)
	{
		this.sourceUserId = sourceUserId;
	}
	
	/**
	 * Gets destination CRT user identifier value
	 * @return Destination CRT user identifier value
	 */
	public String getDestinationUserId()
	{
		return destinationUserId;
	}
	
	/**
	 * Sets the destination CRT user identifier value
	 * @param destinationUserId Destination CRT user identifier value
	 */
	public void setDestinationUserId(String destinationUserId)
	{
		this.destinationUserId = destinationUserId;
	}
	
	
	/**
	 * Gets message content.
	 * @return Message content.
	 */
	public byte[] getMessageContent() 
	{
		return messageContent;
	}
	
	/**
	 * Sets message content.
	 * @param messageContent Message content.
	 */
	public void setMessageContent(byte[] messageContent) 
	{
		 this.messageContent = messageContent;
	}
	
	/**
	 * Sets message identifier.
	 * @param messageId Message identifier.
	 */
	public void setMessageId(Long messageId) 
	{
		this.messageId = messageId;
	}
	
	/**
	 * Gets message identifier.
	 * @return Message identifier.
	 */
	public Long getMessageId() 
	{
		return messageId;
	}
}
